<?php
class StatisticsController extends AppController {

    public $helpers = array('Time');
    public $uses = array('Article','News','Comment','User');

    public function admin_index() {
        $items_on_page = Configure::read('Statistics.displayed.items');
        $articles = $this->Article->findAll(array('visible'=>1),array("id","seo_link","created","title"),array("created" => "desc"),$items_on_page);
        $comments = $this->Comment->findAll(null,array("Comment.id","Comment.title","Article.seo_link","Article.created"),array("Comment.created" => "desc"),$items_on_page);
        $news = $this->News->findAll(null,array("title","created","seo_link"),array("News.created"=>"desc"),$items_on_page);
        $users = $this->User->findAll(null,array("username","id"),array("User.created"=>"desc"),$items_on_page);

        $this->set(compact("articles","comments","news","users"));
    }
}
?>